import { useState } from 'react';
import { WithCounter } from './WithCounter';

const ClickCounter = (props: any) => {
  // 点击次数，是组件状体
  // const [count, setCount] = useState(0);
  // const incrementCount = () => {
  //   setCount(count + 1);
  // };

  return (
    <div>
      {/* 原来使用的是自己定义的 */}
      {/* <button onClick={incrementCount}>按钮被点击了{count}次</button> */}
      <div draggable={true}>拖我</div>
      <button onClick={props.incrementCount}>
        按钮被点击了{props.count}次
      </button>
    </div>
  );
};

export default WithCounter(ClickCounter);
